<!doctype html>
<html>
    <head>
        <title>注册克克美</title>
        <!--        <meta charset="utf-8">
                <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />-->
        <meta name="viewport" content="width=320,maximum-scale=1.3,user-scalable=no">
        <meta http-equiv = "Content-Type" content="text/html; charset=UTF-8"/>
        <meta content="width=device-width,target-densitydpi=device-dpi,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" name="viewport">
        <meta content="yes" name="apple-mobile-web-app-capable">
        <style type="text/css">
            .content{
                align-content: center;
            }
            #phone{
                text-align:left;
                font-size: 16px; 
                width: 91%; 
                height: 45px;
                border-radius:10px 10px 10px 10px;
                outline:none;
                border:1px solid #fe357b ; 
                margin-top: 10px; 
                padding-left: 20px;

            }
            #code{
                text-align:left;
                font-size: 16px; 
                width: 57%; 
                height: 45px;
                border-radius:10px 10px 10px 10px;
                outline:none;
                border:1px solid #fe357b ; 
                margin-top: 20px; 
                padding-left: 20px;

            }
            #pwd{
                text-align:left;
                font-size: 16px; 
                width: 91%; 
                height: 45px;
                border-radius:10px 10px 10px 10px;
                outline:none;
                border:1px solid #fe357b ; 
                margin-top: 20px; 
                padding-left: 20px;

            }
            #vcode{
                width: 31%;
                height: 45px;
                border-radius:10px 10px 10px 10px;
                border:0;
                outline:none; 
                margin-top: -5px; 
                background-color: #fe357b; 
                font-size:14px; 
                color:#fff;
                vertical-align:middle;
            }
            #but{
                width: 100%; 
                height: 45px;
                border-radius:10px 10px 10px 10px;
                border:0;
                outline:none; 
                margin-top: 30px; 
                background-color: #fe357b; 
                font-size:20px; 
                color:#fff
            }
            .protocol{
                margin-top: 20px;
                margin-left: 15px;
                font-size:14px; 
                color:#999;
            }
            .protocol a:link {text-decoration: none;color: #fe357b;}
            .protocol a:visited {text-decoration: none; color: #fe357b;}
            .protocol a:hover {text-decoration: none; color: #fe357b;}
            .protocol a:active {text-decoration: none;font-size: 14px;font-weight: bold;color: #fe357b;}
        </style>
        <style type="text/css">

            img{max-width: 100%; height: auto;}
            .weixin-tip{display: none; position: fixed; left:0; top:0; bottom:0; background: rgba(0,0,0,0.8); filter:alpha(opacity=80);  height: 100%; width: 100%; z-index: 100;}
            .weixin-tip p{text-align: center; margin-top: 10%; padding:0 5%;}
        </style>
    </head>
    <body>
        <div class="content">
            <input type="number"  id="phone" name="phone" placeholder="请输入手机号">
            <input type="number"  id="code" name="code" placeholder="请输入验证码">
            <input type="image" src="__STATIC__/web/index/sweepcode/images/codebut.png" id="vcode" onClick="sendcode()" >
            <input type="password"  id="pwd" name="pwd" placeholder="请输入密码,记住密码">
            <div class="protocol">
                <img src="__STATIC__/web/index/sweepcode/images/queren@3x.png" width="3%" style="vertical-align:middle;">
                我同意克克美
                <span style=" color: #fe357b">
                    <a href="http://app.dwkkm.com/kkmtest/public/index/index/protocol">《服务协议》</a>
                </span>
            </div>
            <input type="image" src="__STATIC__/web/index/sweepcode/images/button.png" id="but" onClick="addSchool()">
            <!--                        <input type="image" src="__ROOT__/Public/images/codebut.png" id="vcode" onClick="see()" >-->
        </div>
        <div style=" padding-left: 25%; padding-top: 30%;">
            <img src="__STATIC__/web/index/sweepcode/images/logo@3x.png" width="65%">
        </div>
        <div class="weixin-tip">
            <p>
                <img src="__STATIC__/web/H5/item/img/android_weixin.png" alt="微信打开" id="imgId" style=" width: 100%"/>
            </p>
        </div>
        <script type="text/javascript" src="__STATIC__/web/index/sweepcode/assets/js/jquery-1.8.1.min.js"></script>
        <script>
                $(".protocol").children("img").click(function () {
                    if ($(this).attr("src") === "__STATIC__/web/index/sweepcode/images/queren_weixuanzhong@3x.png") {
                        $(this).attr("src", "__STATIC__/web/index/sweepcode/images/queren@3x.png");
                    } else {
                        $(this).attr("src", "__STATIC__/web/index/sweepcode/images/queren_weixuanzhong@3x.png");
                    }
                });
        </script>
        
        <script>
            window.onload = function () {
                var ua = navigator.userAgent.toLowerCase();
                var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
                var winHeight = $(window).height();
                if ((navigator.userAgent.match(/(iPhone|iPod|ios|iOS|iPad|Backerry|WebOS|Symbian|Windows Phone|Phone)/i))) {
                    if (userAgent.indexOf("Safari") <= -1) {
                        $("#imgId").attr('src', "__STATIC__/web/H5/item/img/iphone_weixin.png");
                        $(".weixin-tip").css("height", winHeight);
                        $(".weixin-tip").show();
                        die;
                    }
                } else {
                    if (ua.match(/MicroMessenger/i) == "micromessenger") {
                        $("#imgId").attr('src', "__STATIC__/web/H5/item/img/android_weixin.png");
                        $(".weixin-tip").css("height", winHeight);
                        $(".weixin-tip").show();
                        die;
                    }
                }
            };
            //注册
            function addSchool() {
                var phone = document.getElementById("phone").value;
                var code = document.getElementById("code").value;
                var pwd = document.getElementById("pwd").value;
                var id = "{$id}";
                var share_id = "{$share_id}";
                var isno = $(".protocol").children("img").attr("src");
                //alert(isno);
                $.post(
                        "{:url('index/index/register','','')}",
                        {custom_phone: phone, code: code, custom_pwd: pwd, store_id: id, isno: isno, share_id: share_id},
                        function (data) {
                            //alert(data.code);
                            if (data.code == 10009) {
                                alert(data.msg);
                                //window.location.href = "http://a.app.qq.com/o/simple.jsp?pkgname=com.XinSmartSky.kekemei"; /***打开app的下载***/
                                var ua = navigator.userAgent.toLowerCase();
                                var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
                                var winHeight = $(window).height();
                                var store_id = "{$id}";
                                var ctm_phone = data.data;
                                if ((navigator.userAgent.match(/(iPhone|iPod|ios|iOS|iPad|Backerry|WebOS|Symbian|Windows Phone|Phone)/i))) {
                                    if (userAgent.indexOf("Safari") <= -1) {
                                        $("#imgId").attr('src', "__STATIC__/web/H5/item/img/iphone_weixin.png");
                                        $(".weixin-tip").css("height", winHeight);
                                        $(".weixin-tip").show();
                                        die;
                                    }
                                    location.href = 'kkmapp://storeoa.app/openwith?store_id=' + store_id + '&ctm_phone=' + ctm_phone;
                                    window.setTimeout(function () {
                                        location.href = "https://itunes.apple.com/cn/app/ke-ke-mei/id1050527415?mt=8";
                                    }, 30)
                                } else {
                                    if (ua.match(/MicroMessenger/i) == "micromessenger") {
                                        $("#imgId").attr('src', "__STATIC__/web/H5/item/img/android_weixin.png");
                                        $(".weixin-tip").css("height", winHeight);
                                        $(".weixin-tip").show();
                                        die;
                                    }
                                    location.href = 'kkmapp://storeoa.app/openwith?store_id=' + store_id + '&ctm_phone=' + ctm_phone;
                                    window.setTimeout(function () {
                                        location.href = "http://android.myapp.com/myapp/detail.htm?apkName=com.XinSmartSky.kekemei";
                                    }, 30)
                                }
                            } else if (data.code == 0) {
                                //window.location.href = "http://a.app.qq.com/o/simple.jsp?pkgname=com.XinSmartSky.kekemei"; /***打开app的下载***/
                                var store_id = "{$id}";
                                var ctm_phone = data.data;
                                var ua = navigator.userAgent.toLowerCase();
                                var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
                                var winHeight = $(window).height();
                                if ((navigator.userAgent.match(/(iPhone|iPod|ios|iOS|iPad|Backerry|WebOS|Symbian|Windows Phone|Phone)/i))) {
                                    if (userAgent.indexOf("Safari") <= -1) {
                                        $("#imgId").attr('src', "__STATIC__/web/H5/item/img/iphone_weixin.png");
                                        $(".weixin-tip").css("height", winHeight);
                                        $(".weixin-tip").show();
                                        die;
                                    }
                                    location.href = 'kkmapp://storeoa.app/openwith?store_id=' + store_id + '&ctm_phone=' + ctm_phone;
                                    window.setTimeout(function () {
                                        location.href = "https://itunes.apple.com/cn/app/ke-ke-mei/id1050527415?mt=8";
                                    }, 30)
                                } else {
                                    if (ua.match(/MicroMessenger/i) == "micromessenger") {
                                        $("#imgId").attr('src', "__STATIC__/web/H5/item/img/android_weixin.png");
                                        $(".weixin-tip").css("height", winHeight);
                                        $(".weixin-tip").show();
                                        die;
                                    }
                                    location.href = 'kkmapp://storeoa.app/openwith?store_id=' + store_id + '&ctm_phone=' + ctm_phone;
                                    window.setTimeout(function () {
                                        location.href = "http://android.myapp.com/myapp/detail.htm?apkName=com.XinSmartSky.kekemei";
                                    }, 30)
                                }
                            } else {
                                alert(data.msg);
                            }
                        });
                window.alert = function (name) {
                    var iframe = document.createElement("IFRAME");
                    iframe.style.display = "none";
                    iframe.setAttribute("src", 'data:text/plain,');
                    document.documentElement.appendChild(iframe);
                    window.frames[0].window.alert(name);
                    iframe.parentNode.removeChild(iframe);
                }

            }
            //发送验证码
            function sendcode() {
                var phone = document.getElementById("phone").value;
                $.post(
                        "{:url('index/index/sendCode','','')}",
                        {custom_phone: phone},
                        function (data) {
                            if (data.code == 10009) {
                                alert(data.msg);
                                //window.location.href = "http://a.app.qq.com/o/simple.jsp?pkgname=com.XinSmartSky.kekemei"; /***打开app的下载***/
                                var store_id = "{$id}";
                                var ctm_phone = data.data;
                                var ua = navigator.userAgent.toLowerCase();
                                var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
                                var winHeight = $(window).height();
                                if ((navigator.userAgent.match(/(iPhone|iPod|ios|iOS|iPad|Backerry|WebOS|Symbian|Windows Phone|Phone)/i))) {
                                    if (userAgent.indexOf("Safari") <= -1) {
                                        $("#imgId").attr('src', "__STATIC__/web/H5/item/img/iphone_weixin.png");
                                        $(".weixin-tip").css("height", winHeight);
                                        $(".weixin-tip").show();
                                        die;
                                    }
                                    location.href = 'kkmapp://storeoa.app/openwith?store_id=' + store_id + '&ctm_phone=' + ctm_phone;
                                    window.setTimeout(function () {
                                        location.href = "https://itunes.apple.com/cn/app/ke-ke-mei/id1050527415?mt=8";
                                    }, 30)
                                } else {
                                    if (ua.match(/MicroMessenger/i) == "micromessenger") {
                                        $("#imgId").attr('src', "__STATIC__/web/H5/item/img/android_weixin.png");
                                        $(".weixin-tip").css("height", winHeight);
                                        $(".weixin-tip").show();
                                        die;
                                    }
                                    location.href = 'kkmapp://storeoa.app/openwith?store_id=' + store_id + '&ctm_phone=' + ctm_phone;
                                    window.setTimeout(function () {
                                        location.href = "http://android.myapp.com/myapp/detail.htm?apkName=com.XinSmartSky.kekemei";
                                    }, 30)
                                }
                            } else {
                                alert(data.msg);
                            }
                        });
                window.alert = function (name) {
                    var iframe = document.createElement("IFRAME");
                    iframe.style.display = "none";
                    iframe.setAttribute("src", 'data:text/plain,');
                    document.documentElement.appendChild(iframe);
                    window.frames[0].window.alert(name);
                    iframe.parentNode.removeChild(iframe);
                }
            }
            //获取手机唯一标识
            function see() {
//                var imei = navigator.userAgent;
//                alert(imei);
                mui.plusReady(function () {
                    alert(JSON.stringify(h.device()));
                    console.log(JSON.stringify(h.device()));
                });

            }
        </script>
        


    </body>
</html>